﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadImg.aspx.cs" Inherits="WebUI.UploadImg" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script language="javascript">
        function passValue(name,code) {
            var img = $(name).attr("value");
            window.opener.$("#ctl00_ContentPlaceHolder1_txtThumbs").attr("value", (img));
            window.opener.$("#ctl00_ContentPlaceHolder1_hfdImgCode").attr("value", (code));
            window.close();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:FileUpload runat="server" ID="uploadFile" Width="300px"/>
        <asp:Button runat="server" ID="btnUpload" Text="Save img to DB" 
            onclick="btnUpload_Click"/>
        <asp:Label ID="lblMsg" runat="server" ForeColor="Green" Text=""></asp:Label>
        <asp:GridView ID="GridViewUploadedImageFile" runat="server"
            AutoGenerateColumns="False" Font-Names="Verdana" 
            Width="90%" 
            BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
            DataKeyNames="ImageID,ImageContent" 
            onrowdatabound="GridViewUploadedImageFile_RowDataBound">
            <AlternatingRowStyle BackColor="#FFD4BA" />
            <HeaderStyle Height="30px" BackColor="#FF9E66" Font-Size="15px" BorderColor="#CCCCCC"
                BorderStyle="Solid" BorderWidth="1px" />
            <RowStyle Height="20px" Font-Size="13px" HorizontalAlign="Center" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" />
            <Columns>
                <asp:BoundField DataField="ImageID" HeaderText="#" Visible="false" HeaderStyle-Width="10%" />               
                <asp:BoundField DataField="ImageName" HeaderText="Image Name" HeaderStyle-Width="25%" />
                <asp:TemplateField HeaderText="List of Images" HeaderStyle-Width="40%">
                    <ItemTemplate>
                        <asp:Image ID="UsrImages" runat="server" Height="50px" Width="50px" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Select one" HeaderStyle-Width="40%">
                    <ItemTemplate>
                        <asp:LinkButton ID="btnSelect" runat="server" Text="Select" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>
